#include "tile_corner_logic.hpp"

namespace hex {
void get_adjacent_corners(const corner_location& corner, corner_location* adj)
{
	for(int i = 0; i != 3; ++i) {
		adj[i].left_side = !corner.left_side;
	}
	if(corner.left_side) {
		adj[0].hex = location(corner.hex.x() - 2, corner.hex.y());
		adj[1].hex = tile_in_direction(corner.hex, NORTH_WEST);
		adj[2].hex = tile_in_direction(corner.hex, SOUTH_WEST);
	} else {
		adj[0].hex = location(corner.hex.x() + 2, corner.hex.y());
		adj[1].hex = tile_in_direction(corner.hex, NORTH_EAST);
		adj[2].hex = tile_in_direction(corner.hex, SOUTH_EAST);
	}
}

void get_adjacent_hexes_to_corner(const corner_location& corner, location* adj)
{
	adj[0] = corner.hex;
	if(corner.left_side) {
		adj[1] = tile_in_direction(corner.hex, NORTH_WEST);
		adj[2] = tile_in_direction(corner.hex, SOUTH_WEST);
	} else {
		adj[1] = tile_in_direction(corner.hex, NORTH_EAST);
		adj[2] = tile_in_direction(corner.hex, SOUTH_EAST);
	}
}

}
